package etnorservice.etnor_service.domain.vo;

import etnorservice.etnor_service.domain.po.Comment;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: cc
 * @Date: 2024/11/30/10:58
 **/
@Data
@Builder
public class CommentVO {
    private Long id;
    private String userName;
    private String userAvatar;
    private String content;
    private Integer likeCount;
    private Boolean isLiked;
    private Date createTime;
    private List<ReplyVO> replies;

    public static CommentVO fromComment(Comment comment) {
        return CommentVO.builder()
                .id(comment.getId())
                .content(comment.getContent())
                .likeCount(comment.getLikeCount())
                .createTime(comment.getCreateTime())
                .build();
    }
}
